using Firestarter.DB.Schema.BO;
using FireStarterModeller.Test;
using Habanero.Testability;

namespace Firestarter.DB.Schema.Test.BO.TestUtils
{
    public class TestUtilsDBView
    {

        public static BOTestFactory<DBView> GetTestFactory()
        {
            return BOTestFactoryRegistry.Instance.Resolve<DBView>();
        }
        /// <summary>
        /// Creates a new saved DBView with a random value assigned to every property
        /// </summary>
        public static DBView CreateSavedDBView()
        {
            DBView dbView = CreateUnsavedValidDBView();
            dbView.Save();
            return dbView;
        }

        /// <summary>
        /// Creates a new unsaved DBView with a random value assigned to every property
        /// </summary>
        public static DBView CreateUnsavedValidDBView()
        {
            DBView dbView = new DBView();
            dbView.DateCreated = TestUtilsShared.GetRandomDate();
            dbView.Owner = TestUtilsShared.GetRandomString();
            dbView.TableName = TestUtilsShared.GetRandomString(1, 255);
            dbView.DatabaseID = TestUtilsDBDatabase.CreateSavedDBDatabase().DatabaseID;
            dbView.TableType = TestUtilsShared.GetRandomString();
            dbView.TableComment = TestUtilsShared.GetRandomString();
            dbView.CreateTime = TestUtilsShared.GetRandomDate();
            dbView.UpdateTime = TestUtilsShared.GetRandomDate();
            //			dbView.PendingChangeType = null;
            dbView.Approved = TestUtilsShared.GetRandomBoolean();
            return dbView;
        }

        /// <summary>
        /// Creates a new unsaved DBView where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DBView CreateUnsavedDefaultDBView()
        {
            DBView dbView = new DBView();
            return dbView;
        }
    }
}